import { RouteRecordRaw } from 'vue-router';
/**
 * 建议：路由 path 路径与文件夹名称相同，找文件可浏览器地址找，方便定位文件位置
 *
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      isLink：        是否超链接菜单，开启外链条件，`1、isLink: 链接地址不为空 2、isIframe:false`
 *      isHide：        是否隐藏此路由
 *      isKeepAlive：   是否缓存组件状态
 *      isAffix：       是否固定在 tagsView 栏上
 *      isIframe：      是否内嵌窗口，开启条件，`1、isIframe:true 2、isLink：链接地址不为空`
 *      roles：         当前路由权限标识，取角色管理。控制路由显示、隐藏。超级管理员：admin 普通角色：common
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 *      sort            排序
 * }
 */


// 静态路由
export const staterouter: Array<RouteRecordRaw> = [
    {
        path: '/login',
        name: 'login',
        component: () => import('/@/views/login/index.vue'),
        meta: {
            title: '登录'
        }
    },
    /**
     * 这里为全屏展示界面
     * 添加需要的页面请在dynamic_routing 菜单页面中添加
     */
    {
        path: '/DataViewDemo1',
        name: 'DataViewDemo1',
        component: () => import('/@/views/Datavis_1View/index.vue')
    },
    {
        path: '/DataViewDemo2',
        name: 'DataViewDemo2',
        component: () => import('/@/views/Datavis_2View/index.vue')
    },
    {
        path: '/',
        component: () => import('/@/MainPage/index.vue'),
        redirect: '/home',
        children: [
            {
                path: '/home',
                name: 'home',
                component: () => import('/@/views/home/index.vue'),
                meta: {
                    title: 'message.routes.home',
                    roles: ['admin', 'common'],
                    icon: 'iconfont icon-shouye',
                    type: '菜单',
                    sort: 1
                }
            },
        ]
        }

]

/**
 * 动态路由
 * 请按照格式进行添加
 */
export const dynamic_routing: Array<RouteRecordRaw> = [
    {
        path: '/',
        component: () => import('/@/MainPage/index.vue'),
        redirect: '/home',
        children: [
            // {
            //     path: '/home',
            //     name: 'home',
            //     component: () => import('/@/views/home/index.vue'),
            //     meta: {
            //         title: 'message.routes.home',
            //         roles: ['admin', 'common'],
            //         icon: 'iconfont icon-shouye',
            //         type: '菜单',
            //         sort: 1
            //     }
            // },
            {
                path: '/sysmen',
                name: 'sysmen',
                component: () => import('/@/views/sysmen/index.vue'),
                redirect: '/sysmen/menus',
                meta: {
                    title: 'message.routes.sysmen',
                    icon: 'iconfont icon-xitong',
                    roles: ['admin'],
                    type: '菜单',
                    sort: 1
                },
                children: [
                    {
                        path: '/sysmen/menus',
                        name: 'menus',
                        component: () => import('/@/views/sysmen/menus/index.vue'),
                        meta: {
                            title: 'message.routes.menus',
                            roles: ['admin'],
                            icon: 'iconfont icon-caidan',
                            type: '菜单',
                            sort: 1
                        },
                    },
                    {
                        path: '/sysmen/roles',
                        name: 'roles',
                        component: () => import('/@/views/sysmen/roles/index.vue'),
                        meta: {
                            title: 'message.routes.roles',
                            roles: ['admin'],
                            icon: 'iconfont icon-jiaose',
                            type: '菜单',
                            sort: 1
                        },
                    },
                    {
                        path: '/sysmen/UserControl',
                        name: 'UserControl',
                        component: () => import('/@/views/sysmen/userControl/index.vue'),
                        meta: {
                            title: 'message.routes.UserControl',
                            roles: ['admin'],
                            icon: 'iconfont icon-yonghu',
                            type: '菜单',//类型
                            sort: 1
                        },
                    },
                    {
                        path: '/sysmen/DepManagement',
                        name: 'DepManagement',
                        component: () => import('/@/views/sysmen/DepManagement/index.vue'),
                        meta: {
                            title: 'message.routes.DepManagement',
                            roles: ['admin'],
                            icon: 'iconfont icon-yonghu',
                            type: '菜单',//类型
                            sort: 1
                        },
                    }, {
                        path: '/sysmen/DicManagement',
                        name: 'DicManagement',
                        component: () => import('/@/views/sysmen/DicManagement/index.vue'),
                        meta: {
                            title: 'message.routes.DicManagement',
                            roles: ['admin'],
                            icon: 'iconfont icon-yonghu',
                            type: '菜单',//类型
                            sort: 1
                        },
                    },
                ]
            },
            {
                path: '/jurisdiction',
                name: 'jurisdiction',
                meta: {
                    title: 'message.routes.jurisdiction',
                    roles: ['admin', 'common'],
                    icon: 'iconfont icon-quanxian',
                    type: '菜单',
                    sort: 1
                },
                redirect: '/jurisdiction/leading_end',
                children: [{
                    path: '/jurisdiction/leading_end',
                    name: 'leading_end',
                    redirect: '/jurisdiction/leading_end/leading_end_page',
                    meta: {
                        title: 'message.routes.leading_end',
                        roles: ['admin', 'common'],
                        icon: '',
                        type: '菜单',
                        sort: 1
                    },
                    children: [{
                        path: '/jurisdiction/leading_end/leading_end_page',
                        name: 'leading_end_page',
                        component: () => import('/@/views/jurisdiction/leading_end_page/index.vue'),
                        meta: {
                            title: 'message.routes.leading_end_page',
                            roles: ['admin', 'common'],
                            icon: '',
                            type: '菜单',
                            sort: 1
                        },

                    }]
                },
                {
                    path: '/jurisdiction/after_end',
                    name: 'after_end',
                    redirect: '/page',
                    meta: {
                        title: 'message.routes.after_end',
                        roles: ['admin'],
                        icon: '',
                        type: '菜单',
                        sort: 1
                    },
                    children: [{
                        path: '/jurisdiction/after_end/back_end_page',
                        name: 'back_end_page',
                        component: () => import('/@/views/jurisdiction/back_end_page/index.vue'),
                        meta: {
                            title: 'message.routes.back_end_page',
                            roles: ['admin', 'common'],
                            icon: '',
                            type: '菜单',
                            sort: 1
                        },

                    }]
                }
                ]

            },
            {
                path: '/function',
                name: 'function',
                meta: {
                    title: 'message.routes.function',
                    roles: ['admin', 'common'],
                    icon: 'iconfont icon-gongneng',
                    type: '菜单',
                    sort: 1
                },
                redirect: '/function/tagsView',
                children: [{
                    path: '/function/tagsView',
                    name: 'tagsView',
                    component: () => import('/@/views/func/tagsView/index.vue'),
                    meta: {
                        title: 'message.routes.tagsView',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-yemiancaozuo',
                        type: '菜单',
                        sort: 1
                    },
                },
                {
                    path: '/function/Digital_scroll',
                    name: 'Digital_scroll',
                    component: () => import('/@/views/func/Digital_scroll/index.vue'),
                    meta: {
                        title: 'message.routes.Digital_scroll',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-shuzigundong',
                        type: '菜单',
                        sort: 1
                    },
                },
                {
                    path: '/function/file_operating',
                    name: 'file_operating',
                    component: () => import('/@/views/func/file_operating/index.vue'),
                    meta: {
                        title: 'message.routes.file_operating',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-wenjianguanli',
                        type: '菜单',
                        sort: 1
                    },
                }
                ]
            },
            {
                path: '/pages',
                name: 'pages',
                meta: {
                    title: 'message.routes.pages',
                    roles: ['admin', 'common'],
                    icon: 'iconfont icon-yemian',
                    type: '菜单',
                    sort: 1
                },
                redirect: '/pages/Filter_element',
                children: [{
                    path: '/pages/Filter_element',
                    name: 'Filter_element',
                    meta: {
                        title: 'message.routes.Filter_element',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-shaixuan',
                        type: '菜单',
                        sort: 1
                    },
                    component: () => import('/@/views/pages/Filter_element/index.vue')
                },
                {
                    path: '/pages/excel',
                    name: 'excel',
                    meta: {
                        title: 'message.routes.excel',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-biaoge',
                        type: '菜单',
                        sort: 1
                    },
                    component: () => import('/@/views/pages/excel/index.vue')
                },
                {
                    path: '/pages/waves',
                    name: 'waves',
                    meta: {
                        title: 'message.routes.waves',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-round-waves-px',
                        type: '菜单',
                        sort: 1
                    },
                    component: () => import('/@/views/pages/waves/index.vue')
                },
                {
                    path: '/pages/ray_tracing',
                    name: 'ray_tracing',
                    meta: {
                        title: 'message.routes.ray_tracing',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-guangxianganying',
                        type: '菜单',
                        sort: 1
                    },
                    component: () => import('/@/views/pages/ray_tracing/index.vue')
                },
                {
                    path: '/pages/editor',
                    name: 'editor',
                    meta: {
                        title: 'message.routes.editor',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-editor',
                        type: '菜单',
                        sort: 1
                    },
                    component: () => import('/@/views/pages/editor/index.vue')
                }
                ]
            },
            {
                path: '/modular_package',
                name: 'modular_package',
                meta: {
                    title: 'message.routes.modular_package',
                    roles: ['admin', 'common'],
                    icon: 'iconfont icon-zujian',
                    type: '菜单',
                    sort: 1
                },
                redirect: '/modular_package/table',
                children: [
                    {
                        path: '/modular_package/table',
                        name: 'table',
                        meta: {
                            title: 'message.routes.table',
                            roles: ['admin', 'common'],
                            icon: 'iconfont icon-biaoge',
                            type: '菜单',
                            sort: 1
                        },
                        component: () => import('/@/views/modular_package/table/index.vue')
                    },
                    {
                        path: '/modular_package/dynamic_form',
                        name: 'dynamic_form',
                        meta: {
                            title: 'message.routes.dynamic_form',
                            roles: ['admin', 'common'],
                            icon: 'iconfont icon-biaodan1',
                            type: '菜单',
                            sort: 1
                        },
                        component: () => import('/@/views/modular_package/dynamic_form/index.vue')
                    },
                ]
            },
            {
                path: '/Data_visualization',
                name: 'Data_visualization',
                meta: {
                    title: 'message.routes.Data_visualization',
                    roles: ['admin', 'common'],
                    icon: 'iconfont icon-shuju',
                    type: '菜单',
                    sort: 1
                },
                redirect: '/Data_visualization/Datavis_1',
                children: [{
                    path: '/Data_visualization/Datavis_1',
                    name: 'Datavis_1',
                    meta: {
                        title: 'message.routes.Datavis_1',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-keshihuakanban',
                        type: '菜单',
                        sort: 1
                    },
                    component: () => import('/@/MainPage/RouterView/Datavis_1/index.vue')
                },
                {
                    path: '/Data_visualization/Datavis_2',
                    name: 'Datavis_2',
                    meta: {
                        title: 'message.routes.Datavis_2',
                        roles: ['admin', 'common'],
                        icon: 'iconfont icon-keshihuakanban',
                        type: '菜单',
                        sort: 1
                    },
                    component: () => import('/@/MainPage/RouterView/Datavis_2/index.vue')
                }
                ]
            },
        ]
    }
]
/**
 * 定义404、401界面
 * @link 参考：https://next.router.vuejs.org/zh/guide/essentials/history-mode.html#netlify
 */
export const notFoundAndNoPower = [
    {
        path: '/:path(.*)*',
        name: 'notFound',
        component: () => import('/@/views/error/404.vue'),
        meta: {
            title: '404',
            isHide: true,
        },
    },
    {
        path: '/401',
        name: 'noPower',
        component: () => import('/@/views/error/401.vue'),
        meta: {
            title: '401',
            isHide: true,
        },
    },
];